#ifndef LIFEFORM_HH_
#   define LIFEFORM_HH_

#   include "common/Object.hh"

/** Useful to define
 **	Non Playing Characters,
 **	Players,
 **	Wolves, ...
 **	but *NOT* auto-turret, ...
 */

class LifeForm : public Object
{
public:
  // __________ Server Side Methods __________

  /** change global character but also bodyParts health
   ** affect accuracy, strength, ...
   **   according to _woundAffectation in BodyPart
   */
  // cd virtualize it to allow BodyParts hit accuracy only on humans...
  // shd be NO
  bool tookShot();

  /// returns true if LifeForm is dead
  bool isDead();

  /// returns true if LifeForm is dying
  bool isDown();

  /** \return true if character has been hit */
  // shd not be here... still true ?
  bool treatShot();

  /** make the character move, according to user or server input
   ** \return new character position
   ** \param move is the move directional vector
   ** makes the character move, according to the map (walls, ...)
   */
  Vector applyMove(Vector direction);



  // ---------- UPDATERS ----------

  /** update sound listener position,
   ** using BodyPart Head coords
   */
  // only 4 humans ? (we cd make an AI sound dependent [based on listeners pos])
  // others source are much more important
  // cd use a _noiseSensibility
  void updateListener();


  /** browse all BodyPart, watching for clothes weight
   ** NOTE: *NOT* thread-safe
   */
  void updateWeight();

  /** browse all BodyPart, watching for their health
   ** NOTE: *NOT* thread-safe
   */
  void updateHealth();

  /** update all characteristics
   ** NOTE: *NOT* thread safe
   */
  void updateCharacteristics();


  // __________ Client Side Methods __________
  /** Makes the LifeForm moves to \param position
   ** \param position: LifeForm's destination
   **	plays character annimations,
   **   moves the wolf, ...
   */
  // TODO: check interceptions (bullet shots, ...), ...
  void doMove(Vector position);


  /** plays falling animation
   ** change position to on_ground
   ** forbid changing position
   ** sets max velocity
   */
  void playIsDown();

private:
  /** from which distance can we hear */
  float _noiseSensibility; // we cd consider that 0 is std human sensibility
};

#endif /* !LIFEFORM_HH_ */
